
DEBUG = -g --debug

all: transfer-file receive-file transfer-lossy-file receive-lossy-file

ft_arq.o: ft_proto.h ft_timers.h ft_arq.h ft_arq.c
	gcc -c ft_arq.c -Wall $(DEBUG)

ft_proto.o: ft_proto.h ft_proto.c
	gcc -c ft_proto.c -Wall $(DEBUG)

ft_timers.o: ft_timers.h ft_timers.c
	gcc -c ft_timers.c -Wall $(DEBUG)

ft_sender.o: ft_sender.c nwsim.h
	gcc -c ft_sender.c -Wall $(DEBHG)

ft_receiver.o: ft_receiver.c nwsim.h
	gcc -c ft_receiver.c -Wall $(DEBUG)

ft_receiver.loss.o: ft_receiver.loss.c nwsim.h
	gcc -c ft_receiver.loss.c -Wall $(DEBUG)

ft_sender.loss.o: ft_sender.loss.c nwsim.h
	gcc -c ft_sender.loss.c -Wall $(DEBUG)

transfer-file: ft_arq.o ft_proto.o ft_timers.o ft_sender.o ft_arq.h ft_proto.h ft_timers.h
	gcc -o transfer-file ft_arq.o ft_proto.o ft_timers.o ft_sender.o -Wall $(DEBUG)

receive-file: ft_arq.o ft_proto.o ft_timers.o ft_receiver.o ft_arq.h ft_proto.h ft_timers.h
	gcc -o receive-file ft_arq.o ft_proto.o ft_timers.o ft_receiver.o -Wall $(DEBUG)

transfer-lossy-file: ft_arq.o ft_proto.o ft_timers.o ft_sender.loss.o ft_arq.h ft_proto.h ft_timers.h
	gcc -o transfer-lossy-file ft_arq.o ft_proto.o ft_timers.o ft_sender.loss.o -Wall $(DEBUG)

receive-lossy-file: ft_arq.o ft_proto.o ft_timers.o ft_receiver.loss.o ft_arq.h ft_proto.h ft_timers.h
	gcc -o receive-lossy-file ft_arq.o ft_proto.o ft_timers.o ft_receiver.loss.o -Wall $(DEBUG)
	
clean:
	rm *.o transfer-file transfer-lossy-file receive-lossy-file receive-file my_repeater -rf

my_repeater: my_repeater.c
	gcc -o my_repeater my_repeater.c $(DEBUG) -Wall
